package lee.study.String;

public class StringReverse {//字符串逆置

    public static String stringReverse(String string, int begin, int end) {
        char[] array = string.toCharArray();
        while (begin <= end) {
            char tmp = array[end];
            array[end] = array[begin];
            array[begin] = tmp;
            begin++;
            end--;
        }
        return new String(array);
    }

    public static void main(String[] args) {
        String str = "abcdefg";
        String ret = stringReverse(str, 0, str.length() - 1);
        System.out.println(ret);
    }
}
